From 0d086872aebd1321f2557f7bf576c00aa010b3a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jonas=20=C3=85dahl?= Date: Tue, 10 Dec 2019 19:23:17 +0100 Subject: [PATCH] gdk/wayland/surface: Use dedicated bool for frame callback freezing The freezing is conditioned on various state, so lets make the thawing a bit more robust. Without this there was a risk that we'd thaw too many times if there was a frame callback requested while the conditions for the freezing were not met. --- gdk/wayland/gdksurface-wayland.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c index b3608dab3b..02409da4e7 100644 --- a/gdk/wayland/gdksurface-wayland.c +++ b/gdk/wayland/gdksurface-wayland.c @@ -85,6 +85,7 @@ struct _GdkWaylandSurface unsigned int mapped : 1; unsigned int pending_commit : 1; unsigned int awaiting_frame : 1; + unsigned int awaiting_frame_frozen : 1; GdkSurfaceTypeHint hint; GdkSurface *transient_for; GdkSurface *popup_parent; @@ -362,7 +363,11 @@ frame_callback (void *data, return; impl->awaiting_frame = FALSE; - gdk_surface_thaw_updates (surface); + if (impl->awaiting_frame_frozen) + { + impl->awaiting_frame_frozen = FALSE; + gdk_surface_thaw_updates (surface); + } timings = gdk_frame_clock_get_timings (clock, impl->pending_frame_counter); impl->pending_frame_counter = 0; @@ -481,7 +486,10 @@ on_frame_clock_after_paint (GdkFrameClock *clock, if (impl->awaiting_frame && impl->pending_frame_counter == gdk_frame_clock_get_frame_counter (clock)) - gdk_surface_freeze_updates (surface); + { + impl->awaiting_frame_frozen = TRUE; + gdk_surface_freeze_updates (surface); + } } void @@ -2570,9 +2578,10 @@ gdk_wayland_surface_hide_surface (GdkSurface *surface) impl->initial_configure_received = FALSE; } - if (impl->awaiting_frame) + impl->awaiting_frame = FALSE; + if (impl->awaiting_frame_frozen) { - impl->awaiting_frame = FALSE; + impl->awaiting_frame_frozen = FALSE; gdk_surface_thaw_updates (surface); } -- 2.30.2